#include "../wxsitemresdata.h"
#include "wxstextentrydialog.h"
#include <wx/textdlg.h>

namespace {
  wxsRegisterItem<wxsTextEntryDialog> Reg( _T( "TextEntryDialog" ), _T( "文本输入对话框" ), wxsTTool, _T( "对话框" ), 50, false );
  WXS_ST_BEGIN( wxsTextEntryDialogStyles, wxT( "wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY" ) );
  WXS_ST_CATEGORY( "wxTextEntryDialog" )
  WXS_ST( wxOK )
  WXS_ST( wxCANCEL )
  WXS_ST( wxCENTRE )
  WXS_ST( wxWS_EX_VALIDATE_RECURSIVELY )
  WXS_ST( wxTE_MULTILINE )
  WXS_ST( wxTE_PASSWORD )
  WXS_ST( wxTE_READONLY )
  WXS_ST( wxTE_RICH )
  WXS_ST( wxTE_RICH2 )
  WXS_ST( wxTE_NOHIDESEL )
  WXS_ST( wxHSCROLL )
  WXS_ST( wxTE_CENTRE )
  WXS_ST( wxTE_RIGHT )
  WXS_ST( wxTE_CHARWRAP )
  WXS_ST( wxTE_WORDWRAP )
  WXS_ST( wxTE_BESTWRAP )
  WXS_ST( wxTE_CAPITALIZE )
  WXS_ST_END()
}

wxsTextEntryDialog::wxsTextEntryDialog( wxsItemResData *Data ):
  wxsTool( Data, &Reg.Info, NULL, wxsTextEntryDialogStyles, ( flVariable | flId | flSubclass | flExtraCode ) ),
  m_sCaption( wxGetTextFromUserPromptStr ),
  m_sMessage( wxEmptyString ),
  m_sDefaultValue( wxEmptyString ) {
}

void wxsTextEntryDialog::OnBuildCreatingCode() {
  switch( GetLanguage() ) {
  case wxsCPP:
    AddHeader( _T( "<wx/textdlg.h>" ), GetInfo().ClassName, 0 );
    Codef( _T( "%C(%W, %t, %t, %t, %T, %P);\n" ), m_sMessage.wx_str(), m_sCaption.wx_str(), m_sDefaultValue.wx_str() );
    BuildSetupWindowCode();
    break;
  case wxsUnknownLanguage:
  default:
    wxsCodeMarks::Unknown( _T( "wxsTextEntryDialog::OnBuildCreatingCode" ), GetLanguage() );
  }
}

void wxsTextEntryDialog::OnEnumToolProperties( M_Code_unused long Flags ) {
  WXS_SHORT_STRING( wxsTextEntryDialog, m_sCaption, _T( "Caption" ), _T( "caption" ), wxGetTextFromUserPromptStr, false );
  WXS_SHORT_STRING( wxsTextEntryDialog, m_sMessage, _T( "Message" ), _T( "message" ), wxEmptyString, false );
  WXS_SHORT_STRING( wxsTextEntryDialog, m_sDefaultValue, _T( "Default Value" ), _T( "default_value" ), wxEmptyString, false );
}
